package mvp.com.bbc.ui.presenter;

import javax.inject.Inject;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import mvp.com.bbc.appContact.AppContact;
import mvp.com.bbc.bean.ArtListBean;
import mvp.com.bbc.ui.model.ArtListNameModel;

/**
 * Created by Administrator on 2017/10/7.
 */

public class ArtListNamePresenter implements AppContact.ArtListNamePresenter {
    private AppContact.ArtListNameModel mListNameModel;
    private AppContact.ArtListNameView mListNameView;

    @Inject
    public ArtListNamePresenter(AppContact.ArtListNameView listNameView) {
        mListNameView = listNameView;
        mListNameModel = new ArtListNameModel();
    }

    @Override
    public void artListNamePresemter() {
        mListNameModel.artListNameModel()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(new Observer<ArtListBean>() {
                    @Override
                    public void onSubscribe(@NonNull Disposable d) {

                    }

                    @Override
                    public void onNext(@NonNull ArtListBean artListBean) {
                        mListNameView.artListNameView(artListBean);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
}
